package com.pureland.boot.generator;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @projectName: pureland_cloud
 * @className: com.pureland.boot.generator.SequenceGeneratorAutoConfiguration
 * @description: 序列生成器自动配置类
 * @author: tong.li
 * @createTime: 2021/1/6 16:44
 * @version: v1.0
 * @copyright: 版权所有 李彤 © 2020
 */
@Configuration
@ConditionalOnWebApplication
@ConditionalOnProperty(prefix = "pureland.generator.sequence", value = "enabled", matchIfMissing = false)
public class SequenceGeneratorAutoConfiguration {


    @Bean
    @ConditionalOnMissingBean(SequenceGenerator.class)
    public SequenceGenerator sequenceGenerator() {
        return new RedisSequenceGenerator();
    }

}
